﻿//define Vehicle Structure
function GSMInfo(gsmlatitude, gsmlongitude, gsmaltitude, gsmaccuracy, gsmaddress) {
    this.latitude = gsmlatitude;
    this.longitude = gsmlongitude;
    this.altitude = gsmaltitude;
    this.accuracy = gsmaccuracy;
    this.address = gsmaddress;
}

function TrackerInfo(did, dname, dtype, gps, longi, lati, gtime, rtime, dir, speed, alti, devicestate, address, ainfo, gsm_info, other_info, pstopped, pstopeedtime, iconname, alarmlatitude, alarmlongitude, alarmspeed, lastalarmtime,lastgeofencename,alarmcustomText) {
    this.deviceid = did;
    this.devicename = dname;
    this.devicetype = dtype;
    this.gpsavailable = gps;
    this.longitude = longi;
    this.latitude = lati;
    this.gpstime = gtime;
    this.receivedtime = rtime;
    this.direction = dir;
    this.speed = speed;
    this.altitude = alti;
    this.address = address;
    this.alarminfo = ainfo;
    this.gsminfo = gsm_info;
    this.otherinfo = other_info;
    this.stopped = pstopped;
    this.stoppedtime = pstopeedtime;
    this.iconname = iconname;
    this.alarmlatitude = alarmlatitude;
    this.alarmlongitude = alarmlongitude;
    this.alarmspeed = alarmspeed;
    this.lastalarmtime = lastalarmtime;
    this.lastgeofencename = lastgeofencename;
    this.alarmcustomText = alarmcustomText;
    //this.setMarker = setMarker;
    //this.setLabel = setLabel;
}
function TrackerInfo(data){
	this.deviceid =						data.sssid;
	this.devicename =					data.devicename;
	this.devicetype =					data.devicetype;
	this.gpsavailable =					data.gpsavailable;
	this.longitude =					data.longitude;
	this.latitude =						data.latitude;
	this.gpstime =						data.gpstime;
	this.receivedtime =					data.receivedtime;
	this.direction =					data.direction;
	this.speed =						data.speed;
	this.altitude =						data.altitude;
	this.devicestate =					data.devicestate;
	this.address =						data.address;
	this.alarminfo =					data.alarminfo;
	this.gsminfo =						null;
	this.otherinfo =					null;
	this.stopped =						null;
	this.stoppedtime =					null;
	this.iconname =						data.iconname;
	this.alarmlatitude =				data.alarmlatitude;
	this.alarmlongitude =				data.alarmlongitude;
	this.alarmspeed =					data.alarmspeed;
	this.lastalarmtime =				data.lastalarmtime
	this.lastgeofencename =				data.lastgeofencename;
	this.alarmcustomText =				data.alarmcustomText;
}
TrackerInfo.prototype.setMarker = function (marker){
    this.marker = marker ;
}

TrackerInfo.prototype.setLabel = function(lbl){
    this.label = lbl;
}

TrackerInfo.prototype.setPlaceMarker = function(pmarker) {
    this.placeMarker = pmarker;
}
TrackerInfo.prototype.getPosition = function () {
	var point = new google.maps.LatLng(this.latitude, this.longitude);
	return point;
}